import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

/**
 * @author: knowno
 * @create: 2025-09-18 09:04
 * @Version 1.0
 **/
public class TestJDBC3 {
    public static void main(String[] args) {

        try {
            Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/hisdb2", "root", "root");
            System.out.println(conn.getClass());
            //3.获取语句执行平台
            String sql = "delete from  role where id>11 ";
            PreparedStatement pstmt = conn.prepareStatement(sql);
            System.out.println(pstmt);
            //4.执行SQL语句 =>增加 删除和的修改 executeUpdate
            int i = pstmt.executeUpdate();
            System.out.println(i);
            //5.关闭资源
            pstmt.close();
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
